package ffte.default

import ffte.property.{FFTGlobeConfig,FFTIOConfig,FFTRTLConfig,getFFTScalaFactor}
import ffte.core.StreamedGroupConfig

/**
 * Default configuration settings for FFT implementations
 *
 * This object contains the default configuration values used throughout
 * the FFT system when no specific configuration is provided. These
 * settings define the default behavior for all FFT components.
 *
 * Configuration Categories:
 * - Global FFT parameters (scaling, algorithm selection)
 * - RTL generation parameters (optimization, precision)
 * - I/O width specifications (input/output bit widths)
 * - Streaming group configurations (parallelism settings)
 */
object config {

    /**
     * Default global FFT configuration
     *
     * Provides default settings for global FFT parameters including
     * scaling factors and algorithm selection preferences.
     *
     * Settings:
     * - fftScaleFactor: 1.2 (moderate scaling for overflow prevention)
     */
    val DefaultFFTGlobeConfig  = FFTGlobeConfig(
        1.2
    )

    /**
     * Default RTL generation configuration
     *
     * Provides default settings for hardware generation including
     * optimization strategies, precision management, and scaling.
     *
     * Settings:
     * - complexMulFast: true (use fast 4-multiplication method)
     * - symmetric: true (enable symmetric number handling)
     * - resolution: -15 (default fractional bits for fixed-point)
     * - twiddleResolution: -17 (reduced precision for twiddle factors)
     * - shiftMethod: logarithmic scaling based on FFT stage
     */
    val DefaultFFTGenRTLConfig = FFTRTLConfig(
          true                                    // Use fast complex multiplication
        , true                                    // Enable symmetric number handling
        , -15                                     // Default fractional bit resolution
        , -17                                     // Twiddle factor resolution
        , {x => Math.round(Math.log(x)/Math.log(2)/getFFTScalaFactor()).toInt}  // Dynamic scaling
    )

    /**
     * Default I/O configuration
     *
     * Provides default settings for input and output data widths
     * in FFT implementations.
     *
     * Settings:
     * - inWidth: 18 bits (standard input precision)
     * - outWidth: 18 bits (standard output precision)
     */
    val DefaultFFTIOConfig = FFTIOConfig(
          18                                      // Input data bit width
        , 18                                      // Output data bit width
    )

    /**
     * Default streaming group configuration
     *
     * Provides default settings for streaming FFT implementations
     including parallelism and grouping parameters.
     *
     * Settings:
     * - G: 1 (single group, no parallelism by default)
     */
    val DefaultStreamedGroupConfig = StreamedGroupConfig(1)
}